package com.flot.yazb.model;

import com.flot.yazb.base.model.BModel;
import com.flot.yazb.base.client.RetrofitFactory;
import com.flot.yazb.aop.stub.RMCallback;
import com.flot.yazb.aop.stub.RMResponse;
import com.flot.yazb.retrofit.service.BService;

import java.util.Map;

/**
 * 没有mode参数的情况下 直接跳换pay_link字段，否则打开二维码支付界面
 * Created by fengdongfei on 2017/9/3.
 */

public class PayModel extends BModel {
    public String pay_link;
    public String mode;

    public static void getLink(String s1, String s2, String s3, String s4, final Transit<PayModel> incubator) {
        RetrofitFactory.getInstance()
                .create(BService.UserService.class)
                .getPayLink(s1,s2,s3,s4)
                .enqueue(new RMCallback<RMResponse<PayModel>>(incubator.getContext()) {
                    @Override
                    protected void onSuccess(RMResponse<PayModel> result) {
                        incubator.onBorn(result.content, result.code(), result.message());
                    }

                    @Override
                    protected void onFail(String errorCode, String errorInfo) {
                        incubator.onBorn(null, errorCode, errorInfo);
                    }
                });
    }
    public static void getVip(Map map, final BModel.Transit<BModel> incubator) {
        RetrofitFactory.getInstance()
                .create(BService.UserService.class)
                .vip(map)
                .enqueue(new RMCallback<RMResponse<BModel>>(incubator.getContext()) {
                    @Override
                    protected void onSuccess(RMResponse<BModel> result) {
                        incubator.onBorn(result.content, result.code(), result.message());
                    }

                    @Override
                    protected void onFail(String errorCode, String errorInfo) {
                        incubator.onBorn(null, errorCode, errorInfo);
                    }
                });
    }
}
